package com.mdd.front.controller;

import com.mdd.common.core.AjaxResult;
import com.mdd.common.core.PageResult;
import com.mdd.front.LikeFrontThreadLocal;
import com.mdd.front.service.IReferrerService;
import com.mdd.front.validate.article.ArticleSearchValidate;
import com.mdd.front.validate.common.IdValidate;
import com.mdd.front.validate.common.PageValidate;
import com.mdd.front.validate.reference.ReferenceCollectValidate;
import com.mdd.front.vo.reference.ReferenceListVo;
import com.mdd.front.vo.seckill.SeckillListVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/referrer")
@Api(tags = "我的推荐人相关api")
public class ReferrerController {
    @Resource
    private IReferrerService iReferrerService;

    @PostMapping("/list")
    @ApiOperation(value = "我的推荐人列表")
    public AjaxResult<PageResult<ReferenceListVo>> myReferrerList(@Validated PageValidate pageValidate,
                                                                  @Validated @RequestBody ReferenceCollectValidate referenceCollectValidate) {
        Integer userId = LikeFrontThreadLocal.getUserId();
        PageResult<ReferenceListVo> pageResult = iReferrerService.list(pageValidate,referenceCollectValidate,userId);
        return AjaxResult.success(pageResult);
    }


}
